<template>
  <!-- 左分类 -->
  <div class="sort pad">
    <!-- 标题 -->
    <div class="title">
      <span class="text colors">精品分类</span>
      <span class="text">全部分类</span>
    </div>
    <!-- 图片 -->
    <div class="sortBox">
      <!--v-for 循环 -->
      <div class="item" v-for="item in tagList" :key="item.id">
        <span>{{ item.tagName }}</span>
        <img :src="item.avatar" alt="标题" />
      </div>
    </div>
  </div>
</template>

<script>
  import { postTags } from '../../api/tags';
  export default {
    name: 'Sort',
    data() {
      return {
        tagList: [],
      };
    },
    methods: {
      //  置顶标签
      async getTopTags() {
        const { data: res } = await postTags('/tags/findAllTopPing');
        this.tagList = res.data;
        // console.log(res.data);
      },
    },
    created() {
      this.getTopTags();
    },
  };
</script>

<style lang="less" scoped>
  @import url('../../state/css/sort/sort.less');
  .pad {
    padding-left: 15px;
    padding-right: 15px;
  }
  .colors {
    color: salmon !important;
  }
</style>
